#希尔排序
def shell_sort(arr):
    count = len(arr)
    step = 2
    group = count // step
    while group > 0:
        for i in range(group):
            j = i + group
            while j < count:
                key = arr[j]
                k = j - group
                while k >= 0 and arr[k] > key:
                    arr[k + group] = arr[k]
                    k -= group
                arr[k+group] = key
                j += group
        group //= step
    return arr
print(shell_sort([5,5,5,2,3,8,1])) 
